/**
 * Candidate number: 35834
 * Directions refer to available continuations of the path (doors)
 */
package tv.starfu.components.ai;

import com.artemis.Component;

public class KybernetePath extends Component {
    private boolean north;
    private boolean east;
    private boolean south;
    private boolean west;
    private int[] path;

    public KybernetePath() {
    }
    
    
    
    /**
     * Create a new (array)tile with given entrance/exits
     * @param north
     * @param east
     * @param south
     * @param west 
     */
    public KybernetePath(boolean north, boolean east, boolean south, boolean west) {
        path = new int[16];
        for(int i = 0; i < 16; ++i) {
            path[i] = 0 ; }
        
        this.north = north;
        this.south = south;
        this.east = east;
        this.west = west;
        
        construct(north, east, south, west);
    }

    /**
     * Construct Tile with given entrance/exit directions
     * @param north
     * @param east
     * @param south
     * @param west 
     */
    private void construct(boolean north, boolean east, boolean south, boolean west) {
        if(north) {
            path[1] = 1;
            path[2] = 1; }
        
        if(east) {
            path[5] = 1;
            path[6] = 1; }
        
        if(south) {
            path[9] = 1;
            path[10] = 1; }
        
        if(west) {
            path[13] = 1;
            path[14] = 1; }
        else 
            for(int i = 0; i < 16; ++i) {
            path[i]=0;
        }
    }
    
    public boolean isEast() {
        return east;
    }

    public void setEast(boolean east) {
        this.east = east;
    }

    public boolean isNorth() {
        return north;
    }

    public void setNorth(boolean north) {
        this.north = north;
    }

    public boolean isSouth() {
        return south;
    }

    public void setSouth(boolean south) {
        this.south = south;
    }

    public boolean isWest() {
        return west;
    }

    public void setWest(boolean west) {
        this.west = west;
    }
    
    
}
